package com.lightboat.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lightboat.common.utils.DateUtils;
import com.lightboat.system.domain.CrmLogisticsRecord;
import com.lightboat.system.mapper.CrmLogisticsRecordMapper;
import com.lightboat.system.service.ICrmLogisticsRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 物流记录Service业务层处理
 *
 * @author lightboat
 * @date 2025-08-22
 */
@Service
@RequiredArgsConstructor
public class CrmLogisticsRecordServiceImpl extends ServiceImpl<CrmLogisticsRecordMapper, CrmLogisticsRecord> implements ICrmLogisticsRecordService {

    private final CrmLogisticsRecordMapper crmLogisticsRecordMapper;

    /**
     * 查询物流记录
     *
     * @param id 物流记录主键
     * @return 物流记录
     */
    @Override
    public CrmLogisticsRecord selectCrmLogisticsRecordById(Long id) {
        return crmLogisticsRecordMapper.selectById(id);
    }

    /**
     * 查询物流记录列表
     *
     * @param crmLogisticsRecord 物流记录
     * @return 物流记录
     */
    @Override
    public List<CrmLogisticsRecord> selectCrmLogisticsRecordList(CrmLogisticsRecord crmLogisticsRecord) {
        return crmLogisticsRecordMapper.selectCrmLogisticsRecordList(crmLogisticsRecord);
    }

    /**
     * 新增物流记录
     *
     * @param crmLogisticsRecord 物流记录
     * @return 结果
     */
    @Override
    public int insertCrmLogisticsRecord(CrmLogisticsRecord crmLogisticsRecord) {
        crmLogisticsRecord.setCreateTime(DateUtils.getNowDate());
        return crmLogisticsRecordMapper.insert(crmLogisticsRecord);
    }

    /**
     * 修改物流记录
     *
     * @param crmLogisticsRecord 物流记录
     * @return 结果
     */
    @Override
    public int updateCrmLogisticsRecord(CrmLogisticsRecord crmLogisticsRecord) {
        crmLogisticsRecord.setUpdateTime(DateUtils.getNowDate());
        return crmLogisticsRecordMapper.updateById(crmLogisticsRecord);
    }

    /**
     * 批量删除物流记录
     *
     * @param ids 需要删除的物流记录主键
     * @return 结果
     */
    @Override
    public int deleteCrmLogisticsRecordByIds(Long[] ids) {
        return crmLogisticsRecordMapper.deleteCrmLogisticsRecordByIds(ids);
    }

    /**
     * 删除物流记录信息
     *
     * @param id 物流记录主键
     * @return 结果
     */
    @Override
    public int deleteCrmLogisticsRecordById(Long id) {
        return crmLogisticsRecordMapper.deleteCrmLogisticsRecordById(id);
    }
}
